#include<bits/stdc++.h>
using namespace std;
int main(void){
	stack<char>s;
	char option[100];
	gets(option);
	int i;
	for(i = 0;option[i];i++){
		if(i == 0&&(option[i] == '+'||option[i] == '-')){
			cout<<option[i];continue;
		}
		if((option[i] >= '0' && option[i] <= '9')||option[i] == '.'){
			cout<<option[i];
			if(option[i+1] == 0&&s.empty())break;
			if(option[i+1] == '.')continue;
			if(option[i+1] <'0' || option[i+1] >'9')cout<<" ";
		}
		else if(option[i] == '(')s.push('(');
		else if(option[i] == ')'){
			while(s.top() != '('){
				cout<<s.top();
				s.pop();
				if(!s.empty()||option[i])cout<<" ";
			}
			if(s.top() == '(')s.pop();
		}
		else if(option[i] == '+'||option[i] == '-'||option[i] == '*'||option[i] == '/'){
			if(s.empty())s.push(option[i]);
			else {
				if(option[i] == '+'||option[i] == '-'){
					while(!s.empty()){
						if(s.top() == '(')break;
						cout<<s.top();
						s.pop();
						if(!s.empty()||option[i])cout<<" ";
					}
					s.push(option[i]);
				}
				else {
					while(s.top() == '*'||s.top() == '/'){
						if(s.top() == '(')break;
						cout<<s.top();
						s.pop();
						if(!s.empty()||option[i])cout<<" ";
					}
					s.push(option[i]);
				}
			}
		}
	}
	while(!s.empty()){
		cout<<s.top();
		s.pop();
		if(!s.empty()||option[i])cout<<" ";
	}
	return 0;
}
